<template>
  <div class="container">
    <v-chart autoresize :option="getOption()"></v-chart>
  </div>
</template>

<script lang="ts" setup>
const getOption = () => {
  return {
    xAxis: {
      //最大数值与最小数值
      min: 0,
      max: 100,
      show: false,
    },
    yAxis: {
      //在y轴均匀分布
      type: "category",
      show: false,
    },
    series: {
      type: "bar",
      data: [50],
      //柱条的宽度
      barWidth: 10,
      //设置柱条的背景颜色
      showBackground: true,
      backgroundStyle: {
        color: "#ccc",
      },
      //文本标签
      label: {
        show: true,
        //文字的位置
        position: "right",
        //内容自定义
        formatter: "|",
        color: "#5470c6",
      },
    },
    grid: {
      left: 0,
      top: 0,
      bottom: 0,
      right: 0,
    },
  };
};
</script>

<style scoped>
.container {
  width: 100%;
  height: 100%;
}
</style>
